# Contributor: prspkt <prspkt@protonmail.com>
# Maintainer: prspkt <prspkt@protonmail.com>
pkgname=scrcpy
pkgver=2.7
pkgrel=0
pkgdesc="Display and control your Android device"
url="https://github.com/Genymobile/scrcpy"
arch="all !s390x !ppc64le !loongarch64" # limited by android-tools
license="Apache-2.0"
options="!check" # no test suite
depends="android-tools"
makedepends="ffmpeg-dev mesa-dev meson sdl2-dev libusb-dev"
subpackages="$pkgname-doc
	$pkgname-bash-completion
	$pkgname-zsh-completion"
source="scrcpy-$pkgver.tar.gz::https://github.com/Genymobile/scrcpy/archive/v$pkgver.tar.gz
	https://github.com/Genymobile/scrcpy/releases/download/v$pkgver/scrcpy-server-v$pkgver"

build() {
	abuild-meson \
		-Dcompile_server=false \
		-Dprebuilt_server=/usr/share/scrcpy/scrcpy-server-v$pkgver \
		. output
	meson compile -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
	install -Dm644 "$srcdir"/scrcpy-server-v$pkgver \
		"$pkgdir"/usr/share/scrcpy/scrcpy-server
}

sha512sums="
8029fa9b1ad24746fd56f10398445870e26256160b742be46da2c5c9a1a0d8b2e4301a9f65ca09b75a0162555b4345d30cbede8d07f6f89dc66befab87dfe5b7  scrcpy-2.7.tar.gz
dbb9ec702a7c01d147554aa9a2063c48bd5a9d2bac747fadc7bacca93c257edbc5b30cae1ba412f43d1d3f481fa080edee2ddbfa3e0f2d50a89eab95febf1c9b  scrcpy-server-v2.7
"
